<template>
    <div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>单位名称</label>
            </div>
            <div>
                <p>{{detailData.ProjectName}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>预案名称</label>
            </div>
            <div>
                <p>{{detailData.ConstructionName}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>预案级别</label>
            </div>
            <div>
                <p>{{detailData.ConstructionCompactor}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>是否外审</label>
            </div>
            <div>
                <p>{{detailData.Argumentation}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>是否发布</label>
            </div>
            <div>
                <p>{{detailData.AuditSituation}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>发布日期</label>
            </div>
            <div>
                <p>{{detailData.AuditTime}}</p>
            </div>
        </div>
        <div class="cut-off-rule"></div>
        <div class="form-section">
            <h3>
                附件信息
            </h3>
            <div class="form-item form-item-style1"
                 v-for="(item,index) in detailData.Path"
                 :key="index"
                 @click="preview(item)">
                <div class="label-title label-title1">
                    <label>附件</label>
                </div>
                <div class="right-section">
                    <span>预览</span>
                    <x-icon type="ios-arrow-right"
                            size="20"
                            class="icon-right"></x-icon>
                </div>
            </div>
        </div>
        <myMenu></myMenu>
    </div>
</template>
<script>
import upload from '@/commonComponents/upload/index'
import myMenu from '@/commonComponents/menu'
export default {
    name: 'rescuePlanDetail',
    data () {
        return {
            startTime: '',
            endTime: '',
            userInfo: '',
            regImg: /\.(png|jpg|PNG|JPG|jpeg|JPEG|gif|GIF)$/,
            detailData: {}
        }
    },
    components: {
        upload,
        myMenu
    },
    created () {
        this.userInfo = JSON.parse(localStorage.getItem('userInfo')) || {}
        this.detailData = this.$route.params.detail
    },
    methods: {
        preview (filePath) {
            if (this.regImg.test(filePath)) {
                this.$router.push({
                    path: '/previewImg',
                    query: {
                        previewImg: filePath
                    }
                })
            } else {
                wx.miniProgram.navigateTo({
                    url: `/pages/openDocument/index?filePath=${filePath}`
                })
            }
        }
    }
}
</script>
<style lang="less" scoped>
.select-section {
    display: flex;
}
.select-section div {
    padding-left: 26px;
    background: url(../../../static/images/select.png) no-repeat left center;
    background-size: 17px 17px;
}
.select-section div:first-child {
    margin-right: 58px;
}
.select-section .active {
    background: url(../../../static/images/selected.png) no-repeat left center;
    background-size: 17px 17px;
}
.add-equipment .label-title1 {
    width: 168px;
    line-height: 18px;
}
.select-section div:first-child {
    margin-right: 28px;
}
</style>
